package ywh.player.media
{
	import org.osmf.media.URLResource;
	import ywh.list.CourseItem;
	import ywh.manager.Core;
	import ywh.manager.Tag;
	import ywh.player.PlayerState;
	
	/**
	 * 语言图片展示
	 * @author 杨伟华
	 */
	public class LngPicsShower extends OSMFPlayer
	{
		public static const CN:String = "cn/";
		public static const EN:String = "en/";
		private var _lng:String;
		
		public function LngPicsShower()
		{
			_lng = CN;
		}
		
		public function get lng():String
		{
			return _lng;
		}
		
		public function set lng(value:String):void
		{
			if (value != CN && value != EN)
			{
				throw(new Error("语言设置错误!"));
			}
			else
			{
				_lng = value;
				playItem && (playItem = playItem);
			}
		}
		
		override public function preSyncHandle():void
		{
			_time = 1;
			state = PlayerState.PAUSED;
		}
		
		override protected function get _pTime():Number
		{
			return 0;
		}
		
		override public function set playItem(value:CourseItem):void
		{
			super.playItem = value;
			var isAbsolutePath:Boolean = _playItem.getPropBool(Tag._IS_ABSOLUTE_PATH);
			var urlString:String = Core.getResolvePath(_playItem.getPropString(Tag._PARH) + _lng + _playItem.getPropString(Tag._URL));
			var urlresource:URLResource = new URLResource(urlString);
			_mediasprite.resource = urlresource;
			_mediasprite.media.hasOwnProperty("smoothing") && (_mediasprite.media["smoothing"] = true);
		}
	
	}

}